<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/commons/taglibs.jsp"%>
<script>
	$(document).ready(function() {
		//聚焦第一个输入框
		$("#name").focus();
		//为inputForm注册validate函数
		$("#inputForm").validate({
			rules : {
				marchandise : "required",
				department : "required",
				salesState : "required",
				qrCode : "required",
				memo : "required"
			}
		});
	});
</script>
<form id="inputForm" class="well form-inline" action="${ctx}/adoms/goods/save" method="post">
	<input type="hidden" name="id" value="${goods.id}" />
	<table class="table table-striped table-bordered table-condensed">
		<thead>
			<i class="icon-flag"></i>
			<strong>商品货物表单</strong>
		</thead>
		<tr>
			<td class="span2">所属商品:</td>
			<td>
				<select id="marchandise" name="marchandise.id">
					<c:forEach items="${mList }" var="m" varStatus="index">
						<option value="${m.id }" <c:if test="${goods.marchandise.id == m.id }">selected</c:if>>${index.index + 1}.${m.name }</option>
					</c:forEach>
				</select>
			</td>
		</tr>
		<tr>
			<td>所属部门:</td>
			<td>
				<input id="department" name="department.id" type="hidden" value="${goods.department.id}" size="30" maxlength="80" />
				${goods.department.name}
				<c:if test="${not empty(goods.produceDate) }">
					<input id="produceDate" name="produceDate" type="hidden" value="${goods.produceDate}" size="30" maxlength="80" />
				</c:if>
			</td>
		</tr>
		<c:if test="${not empty(goods.order.id) }">
			<tr class="hide">
				<td>所属订单:</td>
				<td>
					<input id="order" name="order.id" type="hidden" value="${goods.order.id}" size="30" maxlength="80" />
				</td>
			</tr>
		</c:if>
		<tr>
			<td>状态:</td>
			<td>
				<select id="state" name="state">
					<option <c:if test="${empty(goods.state) }">selected</c:if>>待售</option>
					<option <c:if test="${goods.state == '已售' }">selected</c:if>>已售</option>
					<option <c:if test="${goods.state == '已出库' }">selected</c:if>>已出库</option>
				</select>
			</td>
		</tr>
		<tr>
			<td valign="top">货物二维码:</td>
			<td>
				<input id="qrCode" name="qrCode.id" type="hidden" value="${goods.qrCode.id}" size="30" maxlength="80" />
				<img src="${ctx}/adoms/qrGoodsCode/qrImg?qr=${goods.qrCode.qrCode}" />
			</td>
		</tr>
		<tr>
			<td valign="top">备注:</td>
			<td>
				<textarea id="memo" name="memo" rows="4" class="span6">${goods.memo}</textarea>
			</td>
		</tr>
		<tr>
			<td colspan="2">
				<input class="btn" type="submit" value="提交" />
				&nbsp;
				<input class="btn" type="button" value="返回" back="back" />
			</td>
		</tr>
	</table>
</form>
